package view;

import java.awt.BorderLayout;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTabbedPane;

import view.room.RoomPanel;

public class MainView extends JFrame{
	private static final long serialVersionUID = 1L;

	public MainView(){
		super("Quản Lí Khách Sạn - Demo");
		setMinimumSize(new Dimension(800, 600));
		setLocationRelativeTo(null);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
//		setMenuBar(new MenuTray());
		
		add(new ToolBar(), BorderLayout.NORTH);
//		add(new SideBar(), BorderLayout.WEST);
		
		JTabbedPane tabView = new JTabbedPane(JTabbedPane.LEFT);
		
		tabView.addTab("Le Tan", null);
		tabView.addTab("Phong",		new RoomPanel());
		tabView.addTab("Dat Phong", new BookPanel());
		tabView.addTab("Thue Phong",new CheckinPanel());
		tabView.addTab("Tra Phong", new CheckoutPanel());
		
		String[] tabNames = {"Le Tan", "Phong", "Dat Phong", "Thue Phong", "Tra Phong"};
		for (int i=0; i<tabNames.length; i++){
			tabView.setTabComponentAt(i, new CustomTab(tabNames[i]));
		}
		add(tabView, BorderLayout.CENTER);
		setVisible(true);
		setExtendedState(JFrame.MAXIMIZED_BOTH);
	}
	
	class CustomTab extends JLabel{
		
		public CustomTab(String title){
			super(title);
			setPreferredSize(new Dimension(120, 30));
		}
	}
}
